package com.todo.todolist.Repository;

import com.todo.todolist.Entity.TodoList;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import javax.transaction.Transactional;
import java.util.List;

public interface TodoListRepository extends CrudRepository<TodoList, Integer> {

    @Query("select todoList from TodoList todoList where todoList.j_session=?1")
    List<TodoList> findByJ_session(String j_session);

    @Query("select todoList from TodoList todoList order by todoList.create_time")
    List<TodoList> findAllOrderByCreate_time();

    @Transactional
    void deleteTodoListById(String id);
}
